package test.fun;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;

import java.io.IOException;

/**
 * ClassName: GetConnet
 * Package: test.fun
 * Description:
 *          静态代码块创建连接
 * @Author ChenJun
 * @Create 2023/4/23 9:28
 * @Version 1.0
 */
public class GetConnet {


        //TODO 静态代码块创建连接
        public static Connection connection;

        static {
            Configuration configuration = HBaseConfiguration.create();
            try {
                connection = ConnectionFactory.createConnection(configuration);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
    }
}
